II Something
by Clark Hugh Stiles
October 31, 2001 

B2TR -- I've got a couple of GS CPUs around, a bunch of other hardware including a monitor (well, two, but one on permanent loan to the old grayhaired dad computer museum), both common SCSI cards, a GS video importer, at least two different 4 meg GS memory expander cards, ADB keyboards and mice, modems, floppy drives, a 44 meg Syquest, a couple of EZDrives, and an ImageWriter II. I think a couple of the hardware items were made by companies which still exist (one of them being Apple). 

It's nice to know that I could if I wanted to, but I've not fired up a real Apple II in three years or more. 

B2TR is shorthand for "Bernie ][ the Rescue", the GS emulation software for the Mac (and BeOS? Dunno, don't care). I registered it long ago, but my registration code doesn't work on later versions. I'd love to try out the online stuff, maybe I will soon. For one thing, I want to see the fake AOL Instant Messenger on the GS. So, I run version 5 of B2TR, and that 30 minute tryout period is way too short sometimes. I have managed to edit last week's DISK.MENU version in AppleSoft and FreeWriter, tested features a few times, and rebuilt my favorite tools from my halcyon days of AppleSoft "hacking" -- bas2text and bas3text, listed below, respectively: 
0 CALL 64780:
INPUT "Filename? ";F$:
F$=LEFT$(F$,13)+".T":
?CHR$(4);"OPEN"+F$:
?CHR$(4);"WRITE"+F$:
LIST 1,:
?CHR$(4);"CLOSE"+F$:
TEXT:END
RUN 

63999 CALL 64780:
INPUT "Filename? ";F$:
F$=LEFT$(F$,13)+".T":
?CHR$(4);"OPEN"+F$:
?CHR$(4);"WRITE"+F$:
LIST -63998:
?CHR$(4);"CLOSE"+F$:
TEXT:END
RUN 63999 
Other than the line breaks, these look like a couple of lines of AppleSoft, and when used they will wind up that way. These are Beagle Bros based EXEC files. Type each one in as two lines of text in a text editor (Mac, Apple II, whatever) and eschew the smart quotes (those things suck anyway). The first listing should be saved as an ASCII text file, "bas2text"; the word "run" shown in the listing is a separate line. The second listing should be saved as "bas3text", with the words "run 63999" as a separate line. In other words, these are two, two-line ASCII text files. 

With the program loaded, type "-bas2text" or "-bas3text", depending on your needs. Omit the quote marks when you do; type one or the other, and hit RETURN. Since these are EXEC files, they'll replace lines 0 (the lowest possible) or 63999 (the highest possible) of your program, respectively. So, in other words, you'll need to start with a program lacking one of these line numbers. If you don't have that, rewrite bas2text using a different line number. 

With the program loaded, type "-bas2text" or "-bas3text", depending on your needs. Omit the quote marks when you do; type one or the other, and hit RETURN. Since these are EXEC files, they'll replace lines 0 (the lowest possible) or 63999 (the highest possible) of your program, respectively. So, in other words, you'll need to start with a program lacking one of these line numbers. If you don't have that, rewrite bas2text using a different line number. 

The CALL at the beginning of the program is an elegant way to avoid some ugliness when the program is first run. EXEC files pump out a carriage return at the end of execution. I don't know why, but this doesn't have an impact on an INPUT statement such as the one by which these one-liners begin, but it does louse up the interface. The CALL absorbs the carriage return, and the INPUT routine operates normally as a consequence. 

There's a quick change to the filename you've INPUT in order to avoid errors or overwriting the original BASIC file. If necessary the name is shortened to 13 characters, and a ".t" suffix is added. This makes it easy to figure out what the text file is for. Nothing else is done to the INPUT data, so illegal filenames will error out and nothing will be saved. 

The original technique behind this program is probably older than the Beagle Bros. I haven't read the old Apple II mags in a long while, and I'm not going to dig around to find more information. I do plan to re-edit the old issues of II Something so perhaps there's something in there, though I doubt it. 

The end result of running one of these programs is an ASCII text file containing the program listing. Ideally, it will omit these little converter one-liners, leaving you with the full version of your larger AppleSoft program ready for editing in a text editor. 

The DiskMenu program from the last edition, complete with the embedded Control characters and edits shown, plus these converter EXEC files, can be found as an attachment to this message. One version is a Binary II / ShrinkIt archive, the other is a Mac Stuffit archive containing both the other archive and its contents, plus this edition and October 24's. This edition is running a little shorter than anticipated, but such Apple II news as exists can be found elsewhere. 
Critique 
Some people don't see the relevance of BASIC, and never had any interest. Most of those who had it in the past have lost it. I've lost it, but haven't lost my interest in BASIC. Here's a simple one line program: 
1 TEXT:
HOME:
FOR X = 1 TO 4000:
VTAB 5:
HTAB 10 - LEN ( STR$ (X)):
PRINT X:
NEXT 
All it does when run in AppleSoft is print in ascending order a right justified display of all the integers between 1 and 4000, inclusive. With slight modifications, this program will run under most or all versions of BASIC on all platforms. The only modification that will be necessary in most cases is the way the screen location is selected. 

One of the peculiarities of other forms of BASIC is that the conversion of the X variable to a text string (STR$(X)) is that one or more space characters are added to beginning or end of the string. AppleSoft doesn't do this, which is a credit to it and to Apple. 

AppleSoft was licensed in part from Microsoft, but that's always been a mystery to me. Woz' Integer BASIC (the pre-IIe BASIC in ROM that DOS 3.3 used to load into the "Language Card"; the only BASIC available on the Apple II and earliest II+ revisions) did a few different things, had different CALLs, PEEKs, and POKEs, and most obviously had no built-in floating point capability (it did however have a MODulus function), but is not freakishly out of place in the BASIC universe. 

Bas2text and Bas3text won't work under Integer BASIC however; I'm a little hazy as to why that is, and I'm not going to boot up one of my real Apple II's to figure it out. I think it has to do with EXEC -- the EXEC command won't direct input to Integer BASIC, or something like that. 